-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Setting configuration with JSON string #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…e FIREWHEEL config.
|
I like that it will not require a user to have to pass the whole block to set one element. Do we need to consider whether there is ever a need to remove key-value pairs from the configuration? (In which case, this removes the method of just omitting it from the JSON as an option to accomplish that). Maybe we just say that a FIREWHEEL config should have all the settings defined, and so we don't support removing a field. Not sure that's best, because I don't know how a user would say "go back to the default" (other than checking the docs and manually setting it to that value, which seems like an unfriendly thing to do). If we do establish that expectation, it's probably worth being aware that the |
|
Looks good to me other than the comments above. To be "that guy", do we need/want a test or two? |
While I don't like adding another dependency, this would "only" be the case for the CI, and won't impact end users. Additionally, this would be a wholly optional thing for users. Another benefit to this approach is less code maintenance that we have to write, which is always a positive. On the other hand, I'm going to play with |
Cycling back to this, I tried |
gregjacobus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure why, but this doesn't allow spaces in the json string. For example, the following command fails saying it's invalid json, when it actually is valid:
firewheel config set -j '{"ansible":{"git_servers": []}}'
Looks like the input arguments get split as strings on whitespace rather than as shell inputs, so quoted inputs are ignored and your string gets parsed as just |
# Pull Request Title ## Description The `firewheel config set -s ...` command does not properly handle whitespace. It takes arguments from the command line and splits them using whitespace (ignoring CLI indicators like quoted parameters). Instead of using the `str.split` method, the `ConfigureFirewheel` object (and the underlying `Config` object) should use `shlex.split`. ## Related Issue See [related discussion](#166 (review)) on #166. ## Type of Change Please select the type of change your pull request introduces: - [x] Bugfix - [ ] New feature - [ ] Documentation update - [ ] Other (please describe): ## Checklist - [x] This PR conforms to the process detailed in the [Contributing Guide](https://sandialabs.github.io/firewheel/developer/contributing.html). - [x] I have included no proprietary/sensitive information in my code. - [x] I have performed a self-review of my code. - [ ] N/A ~I have commented my code, particularly in hard-to-understand areas.~ - [ ] N/A ~I have made corresponding changes to the documentation.~ - [x] My changes generate no new warnings. - [x] I have tested my code.
Signed-off-by: Steven Elliott <[email protected]>
Following up on this, this is resolved as of #207 and I have verified that spaces now work. |
Co-authored-by: Mitch Negus <[email protected]> Signed-off-by: Steven Elliott <[email protected]>
Always be "that guy"! I just added some test cases :) |
This PR adds the ability for users to take in a properly formatted JSON string and set the FIREWHEEL configuration.
This JSON string will set/replace a subset of the configuration and any keys or sub-keys (or sub-sub-keys) not present will not be impacted or overwritten.
The string must include the top-level config key as well as any sub-keys needing modifications.
For example, to change the value for the config key
logging.levelfrom DEBUG to INFO, here is how that would not look:Before Config
After Config